Skip to content

feat: Add NVIDIA provider support with OpenAI-compatible API#2847

Open
rohithmahesh3 wants to merge 4 commits intotailcallhq:mainfrom
rohithmahesh3:feat/nvidia-provider
Open

feat: Add NVIDIA provider support with OpenAI-compatible API#2847
rohithmahesh3 wants to merge 4 commits intotailcallhq:mainfrom
rohithmahesh3:feat/nvidia-provider

Conversation

@rohithmahesh3
Copy link
Copy Markdown

Summary

Add NVIDIA as a supported provider using their OpenAI-compatible API, with handling for NVIDIA-specific response and request format requirements.

Context

NVIDIA's API endpoint (integrate.api.nvidia.com) follows the OpenAI chat completions format but has two key differences:

  1. Response format: NVIDIA sends reasoning_content instead of reasoning, and sometimes sends both fields simultaneously. The previous #[serde(alias)] approach caused deserialization failures when both fields appeared in the same response (serde's "duplicate value" error).
  2. Request constraints: NVIDIA rejects requests with multiple system messages or system messages not positioned at the start of the conversation.

Changes

Provider Registration

  • Added NVIDIA provider constant with string mappings in ProviderId
  • Added NVIDIA entry to provider.json with API URL and NVIDIA_API_KEY environment variable

Response Handling (Serde Fix)

  • Replaced #[serde(alias = "reasoning_content")] with a dedicated reasoning_content field on ResponseMessage
  • Added merged_reasoning() helper that prefers reasoning over reasoning_content when both are present
  • Updated both streaming and non-streaming response paths to use merged_reasoning()

Request Transformer

  • Added MergeSystemMessages transformer that consolidates all system messages into a single leading system message
  • Wired into the provider pipeline for NVIDIA requests only

Testing

  • 4 NVIDIA deserialization tests (tool call streaming, tool call parsing, response message, choice)
  • 4 MergeSystemMessages transformer tests (multiple system messages, single system message, no system messages, empty messages)
  • 2 provider config tests
  • All existing tests updated and passing (551 in forge_app, 282 in forge_domain/forge_repo)

Testing

cargo test -p forge_app -p forge_domain -p forge_repo --lib

All 832 tests pass.

- Add NVIDIA provider constant and configuration
- Add reasoning_content field to handle NVIDIA's response format
- Implement MergeSystemMessages transformer for NVIDIA's system message requirements
- Add comprehensive test coverage for NVIDIA deserialization
@CLAassistant
Copy link
Copy Markdown

CLAassistant commented Apr 5, 2026

CLA assistant check
All committers have signed the CLA.

@github-actions github-actions Bot added the type: feature Brand new functionality, features, pages, workflows, endpoints, etc. label Apr 5, 2026
Comment thread crates/forge_app/src/dto/openai/transformers/ensure_system_first.rs
rohithmahesh3 and others added 2 commits April 5, 2026 11:33
…st.rs

Co-authored-by: graphite-app[bot] <96075541+graphite-app[bot]@users.noreply.github.com>
@github-actions
Copy link
Copy Markdown

Action required: PR inactive for 5 days.
Status update or closure in 10 days.

@github-actions github-actions Bot added the state: inactive No current action needed/possible; issue fixed, out of scope, or superseded. label Apr 13, 2026
@tusharmath tusharmath added the type: provider Updates provider.json configuration. label Apr 17, 2026
@github-actions github-actions Bot removed update: provider state: inactive No current action needed/possible; issue fixed, out of scope, or superseded. labels Apr 17, 2026
@github-actions
Copy link
Copy Markdown

Action required: PR inactive for 5 days.
Status update or closure in 10 days.

@github-actions github-actions Bot added the state: inactive No current action needed/possible; issue fixed, out of scope, or superseded. label Apr 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

state: inactive No current action needed/possible; issue fixed, out of scope, or superseded. type: feature Brand new functionality, features, pages, workflows, endpoints, etc. type: provider Updates provider.json configuration.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants